home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / uberwidgets / clearlink.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  2KB  |  71 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import wx
  5. from wx import HyperlinkCtrl, TRANSPARENT_WINDOW, HL_DEFAULT_STYLE
  6. from config import platformName
  7.  
  8. def clearlink_url(url):
  9.     if callable(url):
  10.         callback = url
  11.         url = '^_^'
  12.     else:
  13.         callback = None
  14.     return (callback, url)
  15.  
  16.  
  17. class ClearLink(HyperlinkCtrl):
  18.     callback = None
  19.     
  20.     def __init__(self, parent, id, label, url, style = HL_DEFAULT_STYLE, pos = wx.DefaultPosition):
  21.         (callback, url) = clearlink_url(url)
  22.         if callback is not None:
  23.             self.callback = callback
  24.         
  25.         if platformName == 'win':
  26.             style = style | TRANSPARENT_WINDOW
  27.         
  28.         HyperlinkCtrl.__init__(self, parent, id, label, url, pos = pos, style = style)
  29.         Bind = self.Bind
  30.         if platformName == 'win':
  31.             self.dopaint = True
  32.             self.min = False
  33.             self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
  34.             Bind(wx.EVT_PAINT, self.OnPaint)
  35.             Bind(wx.EVT_MOTION, self.OnMouseMotion)
  36.             Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
  37.         
  38.         Bind(wx.EVT_HYPERLINK, self.OnHyperlink)
  39.  
  40.     
  41.     def OnHyperlink(self, e):
  42.         if self.callback is not None:
  43.             self.callback()
  44.         else:
  45.             e.Skip()
  46.  
  47.     if platformName == 'win':
  48.         
  49.         def OnMouseMotion(self, event):
  50.             if not self.min:
  51.                 self.min = True
  52.                 event.Skip()
  53.             
  54.  
  55.         
  56.         def OnMouseLeave(self, event):
  57.             self.min = False
  58.             event.Skip()
  59.  
  60.         
  61.         def OnPaint(self, event):
  62.             if self.dopaint:
  63.                 self.dopaint = False
  64.                 event.Skip()
  65.             else:
  66.                 self.dopaint = True
  67.                 self.Parent.RefreshRect(self.Rect)
  68.  
  69.     
  70.  
  71.